<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>添加用户</title>
    <!--<link rel="stylesheet" href="/assets/bootstrap-3.3.5/css/bootstrap.css">-->
    <link rel="stylesheet" href="/layui/css/layui.css">
    <style>
        .layui-form-label {
            width: auto;
        }

        body {
            background-color: #f2f2f2
        }

        #goodsOrderDetailHead {
            height: auto;
            font-size: 15px;
        }
    </style>
</head>
<body>

<div class="layui-form my_form_style" style="margin: 2%">
    <div class="layui-form-item">
        <label class="layui-form-label">用户名</label>
        <div class="layui-input-block">
            <input type="text" name="username" lay-verify="title" autocomplete="off" placeholder="请输入用户名" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">姓名</label>
        <div class="layui-input-block">
            <input type="text" name="xingming" lay-verify="title" autocomplete="off" placeholder="请输入姓名"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">密码</label>
        <div class="layui-input-block">
            <input type="text" name="password" lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
        </div>
    </div>
    <button class="layui-btn my-btn" lay-submit lay-filter="submit">添加</button>
</div>
<script src="/layui/layui.all.js"></script>
<script>
    layui.use(['element', 'layer', 'form'], function () {
        var table = layui.table;
        var element = layui.element;
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
        form.on('submit(submit)', function (data) {
            $.ajax({
                url: '/users/addUser',
                method: "get",
                data: data.field,
                success: function (data1) {
                        layer.msg(data1.msg);
                },
                error:function () {
                    layer.msg("添加失败");
                    // layer.msg("ajax执行失败");
                }
            });
        });
    })
</script>
</body>
</html>